package com.yxy.common.enums;

public enum ProcessSourceEnum {
    FRONT_SERVICE("front_service", 1),
    COLLECT_SERVICE("collect_service", 2),
    CPOWER_SERVICE("cpower_service", 3);

    private final String code;
    private final int order;

    ProcessSourceEnum(String code, int order) {
        this.code = code;
        this.order = order;
    }

    public String getCode() {
        return code;
    }

    public int getOrder() {
        return order;
    }

    public static ProcessSourceEnum getByCode(String code) {
        for (ProcessSourceEnum value : values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }

    public static Integer getOrderByCode(String code) {
        ProcessSourceEnum enumValue = getByCode(code);
        return enumValue != null ? enumValue.getOrder() : null;
    }
}
